﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Guedes_Library;

/// <summary>
/// Summary description for CategoriaBusiness
/// </summary>
public class CategoriaBusiness
{
	public CategoriaBusiness()
	{
		//
		// TODO: Add constructor logic here
		//
	}


    private CategoriaModel model;

    public CategoriaModel Model
    {
        get {
            if (model == null)
                model = new CategoriaModel();
            return model;
        }
        set { model = value; }
    }

    public String Deletar(int id)
    {
        String msg = Mensagem.DELETAR_ERRO;
        if (Model.Delete(id))
            msg = Mensagem.DELETAR_SUCESSO;
        return msg;
    }

    public category GetById(int id)
    {
        return Model.GetById(id);
    }

    public List<category> GetAll()
    {
        return Model.SelectAll();
    }

    public String SaveOrUpdate(category obj)
    {
        Model.Save(obj);
        return "";
    }




}